package com.xcity.game.rank.impl;

import java.util.Comparator;

import com.xcity.db.entity.Player;
import com.xcity.db.entity.Ranking;
import com.xcity.game.common.PlayerPool;
import com.xcity.game.event.GameEvents;
import com.xcity.game.rank.BaseRankingList;

import naga.x.event.Event;

public class BuildAttackRankingList extends BaseRankingList {

	public BuildAttackRankingList(int type, int capacity, Comparator<Ranking> comparator) {
		super(type, capacity, comparator);
	}

	@Override
	public int[] getEventTypes() {
		return new int[] { /*GameEvents.EVENT_ATTACK_BUILD, */GameEvents.EVENT_ATTACK_BUILD_V2 };
	}

	@Override
	public void handleEvent(Event event) {
		Player player = event.getParameter(0);
//		int gold = event.getParameter(3);
		byte result = event.getParameter(3);
		if (result > 0) { // 掠夺成功
			int n = player.poolAdd(PlayerPool.PROPERTY_SUM_OF_BUILD_ATTACK, 1);
			setDirty(player, n);
		}
	}

}
